package org.springcloud.plugin.framework.loadbalance.weight;

import com.netflix.loadbalancer.Server;
import org.springcloud.plugin.common.entity.WeightFilterEntity;
import org.springcloud.plugin.framework.adapter.CoreAdapter;

/**
 * @Author yanggld
 * @Date 2019/12/17-18:23
 * @Description
 */
public class RuleMapWeightRandomLoadBalance extends AbstractMapWeightRandomLoadBalance {

	private RuleWeightRandomLoadBalanceAdapter ruleWeightRandomLoadBalanceAdapter;

	public RuleMapWeightRandomLoadBalance(CoreAdapter coreAdapter) {
		ruleWeightRandomLoadBalanceAdapter = new RuleWeightRandomLoadBalanceAdapter(coreAdapter);
	}

	@Override
	public WeightFilterEntity getT(){
		return ruleWeightRandomLoadBalanceAdapter.getT();
	}

	@Override
	public int getWeight(Server server, WeightFilterEntity weightFilterEntity) {
		return ruleWeightRandomLoadBalanceAdapter.getWeight(server, weightFilterEntity);
	}
}
